using System;
using Microsoft.SPOT;
using System.Threading;

namespace ReefinDotNet
{
    partial class Program
    {
        public void MonitorTemp()
        {
            //Debug.Print("Temp starting on thread: " + Thread.CurrentThread.ManagedThreadId);
            while (true)
            {
                try
                {

                    //temp[0] = temp1.ConvertAndReadTemperature();
                    temp[0] = temp[0] / 5 * 9 + 32;
                    //Debug.Print("At " + System.DateTime.Now.TimeOfDay + " It is " + temp[0] + ".");
                    /*
                    if (temp[0] < 78.75)
                    {
                        //Debug.Print("Running Heater");
                        LCD.write("Heating", 0, 3, 'L');
                        if (heater1.Read() != false)
                            heater1.Write(false);
                    }
                    if (temp[0] > 79.50)
                    {
                        //Debug.Print("Not Runnning Heater");
                        LCD.write("       ", 0, 3, 'L');
                        if (heater1.Read() != true)
                            heater1.Write(true);
                    }
                    string tempS = temp.ToString();
                    tempS = tempS.Substring(0, 5) + "\x00DF";
                    LCD.write(tempS, 14, 0);
                    */
                }

                catch (Exception ex)
                {
                    Debug.Print("Error Caught Getting Temp");
                    Debug.Print(ex.ToString());
                }
                Thread.Sleep(2000);
            }
        }
    }
}
